package com.hlm.analysis;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface DataMapper {
//    通过id拿水温
    @Select("SELECT temp_water+0\n" +
            "FROM data_for_huigui dfh\n" +
            "WHERE terminal_id=#{id}")
    double[] getWaterTempById(Integer id);
//    通过id拿室温
    @Select("SELECT temp_in+0\n" +
            "FROM data_for_huigui dfh\n" +
            "WHERE terminal_id=#{id}")
    double[] getInTempById(Integer id);
//    通过id拿气温
    @Select("SELECT temp_out+0\n" +
            "FROM data_for_huigui dfh\n" +
            "WHERE terminal_id=#{id}")
    double[] getOutTempById(Integer id);

//    拿所有terminal_id
    @Select("SELECT DISTINCT terminal_id\n" +
            "FROM data_for_huigui dfh\n")
    int[] getAllTerminalId();
//    存系数
    @Update("replace into predict_modulus(terminal_id,modulus_a,modulus_b,modulus_c)\n" +
            "VALUES(#{id},#{a},#{b},#{c})")
    void saveMudulus(Integer id,String a,String b,String c);
}
